//
//  UIView+parentController.swift
//  Wmsmobile
//
//  Created by Nick xu on 16/8/4.
//  Copyright © 2016年 hddden. All rights reserved.
//

import UIKit

extension UIView {
    
    func parentController() -> (UIViewController?) {
        var responder:UIResponder? = self.next
        while responder != nil {
            if (responder!.isKind(of: UIViewController.self)) {
                return (responder as! UIViewController)
            }
            responder = responder?.next
        }
        return nil
    }
}
